-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use dynamic completion #10
Conversation
helm-org-startup-visibility filter have been disabled for now as it is not working for some reasons (seems also it slowdown helm-org).
* helm-org.el (helm-org--get-candidates-in-file): Do it.
* helm-org.el (helm-source-org-headings-for-files): Do it.
Hi Thierry, Sorry, I don't understand what this new If this speeds up the headings-in-buffer sources, that would be great, as long as the heading visibility feature doesn't regress in functionality. Thanks. |
alphapapa <[email protected]> writes:
Hi Thierry,
Sorry, I don't understand what this new helm-dynamic-completion and
match-dynamic thing is. I looked at some commits to the main Helm repo
that add them, but I don't understand what it's doing or what its
purpose is. Would you explain, please?
Actual helm-org is taking a list of org filenames (or buffers) as the
:candidates, and compute the list of all headings in those files with
:candidates-in-buffer. Using :match-dynamic with helm-dynamic-completion
allow computing directly the headings in :candidates with
all-completions which is fast and provide as well in addition of usual
multi matching what user set in completion-styles, it can be flex or
helm-flex (similar to fuzzy) depending on the emacs version in use.
If this speeds up the headings-in-buffer sources, that would be great,
as long as the heading visibility feature doesn't regress in
functionality.
It's what I want to know, but I have not huge org buffers so it doesn't
make a significant difference, thus the function used with
helm-dynamic-completion is may be not adapted perfectly for this use.
The only functionality that I have removed is the
filtered-candidate-transformer function helm-org-startup-visibility.
…
Thanks.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.*
--
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997
|
* helm-org.el (helm-org--get-candidates-in-file): Don't use a cons cell but bind helm-realvalue prop.
it is not needed with the dynamic function that ensure all candidates are computed and sorted.
What can be done to speed up this in addition of dynamic completion is doing the same as what we are doing with helm-imenu. |
for each buffer like in helm-imenu. * helm-org.el (helm-org--headers-cache): New internals. (helm-org--buffer-tick): New internals. (helm-org-build-sources): New. (helm-org--get-candidates-in-file): Set cache in each buffer. (helm-org-agenda-files-headings): Use separate sources. (helm-org-in-buffer-headings): Use new fn helm-org-build-sources. (helm-org-parent-headings): Same.
I have pushed the code with cache for individual buffers, please try, I would like to have feedback from people with huge org files. |
only visiting.
Thanks for taking a look at this @thierryvolpiatto! The solution works very well with my largest org file ~1.1MB. The lag used to be several seconds. I no longer notice any lag (after the cache is generated). |
Thanks, but I don't understand what this new Regarding the caching of headings: That's a nice idea, but it seems like a lot of complexity to add to this package. Rather than implementing that in You might also consider using (org-ql-select "~/org/main.org"
'(regexp "*")
:action #'org-ql--outline-path) For retrieving headings matching certain regexps, a search with the terms can be used, like: (org-ql-select "~/org/main.org"
'(heading "word1" "word2")
:action #'org-ql--outline-path) The Some ideas. :) |
alphapapa <[email protected]> writes:
Using :match-dynamic with helm-dynamic-completion allow computing directly the headings in :candidates with all-completions which is fast and provide as well in
addition of usual multi matching what user set in completion-styles, it can be flex or helm-flex (similar to fuzzy) depending on the emacs version in use.
Thanks, but I don't understand what this new helm-dynamic-completion
thing is or how it works. :)
Why is it faster?
Initialization of candidates is not faster, but once done matching is
faster because it is done with all-completions which run in C.
The benefit also is that you have flex (aka fuzzy) matching for free if
needed by using completion-styles.
The actual implementation of helm-org is anyway wrong, it abuse
candidates-transformer and prevent adding any other functionality.
Regarding the caching of headings: That's a nice idea, but it seems
like a lot of complexity to add to this package.
It is not, I wrote it in ten minutes.
Rather than implementing that in helm-org, you might consider looking
at org-ql.
Maybe, but I don't want to enter into the complexity of another package,
and the purpose here is not my usage but how to improve helm-org to
e.g. fix issue #1964 linked here.
Thanks.
…--
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997
|
matthuszagh <[email protected]> writes:
Thanks for taking a look at this @thierryvolpiatto! The solution works very well with my largest org file ~1.1MB.
Great, thanks for testing.
…--
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997
|
About |
When outline paths are not displayed, subheadings are displayed indented to their level. Without that indentation, outline structure would appear flattened, only distinguishable by faces, which are not necessarily distinctive, depending on user configuration. Removing support for that feature would be a significant regression in functionality. |
@thierryvolpiatto The new cache seems to return the wrong results when relevant settings have changed. For example:
|
alphapapa <[email protected]> writes:
@thierryvolpiatto The new cache seems to return the wrong results when relevant settings have changed. For example:
1. Call helm-org-in-buffer-headings.
2. C-g.
3. (setq helm-org-format-outline-path t).
4. Call helm-org-in-buffer-headings again. The results from #1 are displayed instead of the outline path.
5. Insert a character into the Org buffer.
6. Call helm-org-in-buffer-headings again. The outline paths are now displayed.
Works now if you use customize in 3.
Note that you can as well refresh with C-u if needed.
…--
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997
|
alphapapa <[email protected]> writes:
For the second, what is the purpose of indenting the helm buffer? I propose to remove its support.
When outline paths are not displayed, subheadings are displayed
indented to their level. Without that indentation, outline structure
would appear flattened, only distinguishable by faces, which are not
necessarily distinctive, depending on user configuration. Removing
support for that feature would be a significant regression in
functionality.
Ok, just wanted to know, will reenable this with a FCT ASAP.
Thanks.
…--
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997
|
(replace-match "\\1\\2\\3" t nil (car i))))))))) | ||
(cdr i))))) | ||
|
||
(defun helm-org-get-candidates (filenames &optional parents) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thierryvolpiatto Spacemacs used this function syl20bnr/spacemacs#13123
Would you have a suggestion what function can be used instead? 🤔
Eugene Yaremenko <[email protected]> writes:
Would you have a suggestion what function can be used instead? 🤔
Seems Spacemacs called this on a single filename?
Maybe try to use `helm-org--get-candidates-in-file`?
…--
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997
|
@thierryvolpiatto Will try, thanks. Too bad that |
Eugene Yaremenko <[email protected]> writes:
@thierryvolpiatto Will try, thanks. Too bad that helm-org--get-candidates-in-file looks like a private function: helm-org -- get-candidates-in-file
I am not sure what you are doing with this function, but if you use it
for a helm source, you can build directly your source with
(helm-org-build-sources (list your_file_or_buffer))
…--
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997
|
* Fix helm-spacemacs-help-faq In #13136, helm-spacemacs-help-faq supporting functions were rewritten because helm-org-get-candidates was removed upstream (emacs-helm/helm-org#10). One of the supporting functions, helm-spacemacs-help//get-faq-headings-list, doesn't work. As a result, helm-spacemacs-help-faq (M-m h f) fails with "if: Wrong type argument: stringp, helm". It's unclear if this bug has existed since the Spacemacs PR because helm-org-build-sources has changed since the helm-org PR (https://github.com/emacs-helm/helm-org/commits/master/helm-org.el). * Update CHANGELOG.develop
* Fix helm-spacemacs-help-faq In syl20bnr#13136, helm-spacemacs-help-faq supporting functions were rewritten because helm-org-get-candidates was removed upstream (emacs-helm/helm-org#10). One of the supporting functions, helm-spacemacs-help//get-faq-headings-list, doesn't work. As a result, helm-spacemacs-help-faq (M-m h f) fails with "if: Wrong type argument: stringp, helm". It's unclear if this bug has existed since the Spacemacs PR because helm-org-build-sources has changed since the helm-org PR (https://github.com/emacs-helm/helm-org/commits/master/helm-org.el). * Update CHANGELOG.develop
DON'T MERGE, just a proof of concept, let me know people with large org files if it's faster.
Thanks. @alphapapa ping.
helm-org-startup-visibility filter have been disabled for now as it is
not working for some reasons (seems also it slowdown helm-org).
When submitting a pull request, please include the following information:
Emacs-26
The version coming with emacs-26
helm
versions tested with:Last.
helm-core
versions tested with:Last.